package com.qbgs.base;


import java.io.Serializable;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

//import org.codehaus.jackson.map.annotate.JsonSerialize;


/**
 * 返回实体类
 * @author lyh
 * @version 2013-10-30
 * @see BaseResult
 * @since
 */
//@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
public class BaseResult implements Serializable
{

    /**
     * 序列号<br>
     */
    private static final long serialVersionUID = 8464933969358745317L;

    /**
     * 成功失败标识
     */
    private boolean success = true;

    /**
     * 返回提示消息
     */
    private String opMsg = "";

    /**
     * 数据域
     */
    private Map<String, Object> data;

    /**
     * 单实体
     */
    private Object singleEntity;

    /**
     * 记录总数 （命名必须为total 对应easyui分页）
     */
    private int total = 0;

    /**
     * 结果集存放List （命名必须为rows 对应easyui分页）
     */
    private List<Map<String, Object>> rows = new LinkedList<Map<String, Object>>();

    /**
     * 构造器
     */
    public BaseResult()
    {

    }

    /**
     * 构造器  total rows for easyui
     * @param total
     * @param rows
     */
    public BaseResult(int total, List<Map<String, Object>> rows)
    {
        this.total = total;
        this.rows = rows;
    }

    @Override
    public String toString()
    {
        StringBuilder builder = new StringBuilder();
        builder.append("BaseResult [success=").append(success).append(", opMsg=").append(opMsg).append(
            ", data=").append(data).append(", singleEntity=").append(singleEntity).append(
            ", total=").append(total).append(", rows=").append(rows).append("]");
        return builder.toString();
    }

    //setter getter
    public boolean isSuccess()
    {
        return success;
    }

    public void setSuccess(boolean success)
    {
        this.success = success;
    }

    public String getOpMsg()
    {
        return opMsg;
    }

    public void setOpMsg(String opMsg)
    {
        this.opMsg = opMsg;
    }

    public Map<String, Object> getData()
    {
        return data;
    }

    public void setData(Map<String, Object> data)
    {
        this.data = data;
    }

    public int getTotal()
    {
        return total;
    }

    public void setTotal(int total)
    {
        this.total = total;
    }

    public List<Map<String, Object>> getRows()
    {
        return rows;
    }

    public void setRows(List<Map<String, Object>> rows)
    {
        this.rows = rows;
    }

    public Object getSingleEntity()
    {
        return singleEntity;
    }

    public void setSingleEntity(Object singleEntity)
    {
        this.singleEntity = singleEntity;
    }

}
